import React, { Component } from 'react'
import { connect } from 'react-redux'

class TodoList extends Component {
  render () {
    return (
      <div>
        <div>
          <input
            type='text'
            value={this.props.inputValue}
            onChange={this.props.changeInputValue}
          />
          <button>提交</button>
          <ul>
            <li>dell</li>
            <li>tom</li>
            <li>Jim</li>
          </ul>
        </div>
      </div>
    )
  }
  handleInputChange (e) {}
}
const mapStateToProps = state => {
  return {
    inputValue: state.inputValue,
    list: state.list
  }
}
const mapDispatchToProps = dispatch => {
  return {
    changeInputValue (e) {
      const action = {
        type: 'change_input_value',
        value: e.target.value
      }
      dispatch(action)
    }
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(TodoList)
